package com.example.myapplication;

import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import com.example.myapplication.fragment.FragmentAdapter;
import com.example.myapplication.fragment.Tab1Fragment;
import com.example.myapplication.fragment.Tab2Fragment;

import java.util.ArrayList;
import java.util.List;

public class MainActivity2 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        ViewPager viewPager = findViewById(R.id.view_pager);

        List<Fragment> list = new ArrayList<>();
        Tab1Fragment tab1Fragment = new Tab1Fragment();
        list.add(tab1Fragment);

//        第二个
//        ddd
        Tab2Fragment tab2Fragment = new Tab2Fragment();
        list.add(tab2Fragment);


        FragmentAdapter adapter = new FragmentAdapter(getSupportFragmentManager(),list);
        viewPager.setAdapter(adapter);
    }
}
